/*******************************************************************************
 *
 *      Filename: ViewFrustum.h
 *   Description: 
 *        Author: [kb]ypp
 *    Created at: November 6, 2005
 * Last modified: 
 *
 ******************************************************************************/

#ifndef VIEW_FRUSTUM_H
#define VIEW_FRUSTUM_H

//! @brief View frustum class.
//!
//! Contains functions to manage camera view frustum.
class ViewFrustum {
public:
	/*//! @brief Default constructor
	ViewFrustum();*/
	//! @brief Copy-constructor
	ViewFrustum( const ViewFrustum &frustum );
	//! @brief Constuctor with camera view frusum parameters
	explicit ViewFrustum( float fov = 90.0, float aspect = 0.75,
		float near = 1.0, float far = 20.0 );
	
	//! @brief Zoom by `factor'
	void zoom( float factor );

protected:
	enum {
		VF_LEFT_PLANE = 0, //!< Left clipping plane index
		VF_RIGHT_PLANE,    //!< Right clipping plane index
		VF_BOTTOM_PLANE,   //!< Bottom clipping plane index
		VF_TOP_PLANE,      //!< Top clipping plane index
		VF_NEAR_PLANE,     //!< Near clipping plane index
		VF_FAR_PLANE       //!< Far clipping plane index
	};
	void recalculate();
	
	float e; //!< Focal length of the camera
	float fov; //!< Horizontal field of view angle (in degrees)
	float aspect; //!< The ration of screen height to srceen width
	float near; //!< The distance to the near clipping plane
	float far; //!< The distance to the far clipping plane
	Plane planes[ 6 ]; //! View frustum clipping planes
};

#endif // VIEW_FRUSTUM_H
